package cn.kbyue.exceptiondemo.common.exception;

import cn.kbyue.exceptiondemo.common.enums.IResponseEnum;
import lombok.Getter;

@Getter
public class BaseException extends RuntimeException {
    private Integer code;
    private String message;
    private IResponseEnum responseEnum;
    private Object[] args;
    private Throwable cause;

    public BaseException() {
        super();
    }

    public BaseException(IResponseEnum responseEnum) {
        super(responseEnum.getMessage());
        this.responseEnum = responseEnum;
    }

    public BaseException(IResponseEnum responseEnum, Object[] args, String message) {
        super(responseEnum.getMessage());
        this.responseEnum = responseEnum;
        this.args = args;
        this.message = message;
    }

    public BaseException(IResponseEnum responseEnum, Object[] args, String message, Throwable cause) {
        super(responseEnum.getMessage(), cause);
        this.responseEnum = responseEnum;
        this.args = args;
        this.message = message;
        this.cause = cause;
    }

}
